package Li;

import java.util.Arrays;

/**
 * 矩阵的转置
 */
public class test {
    public static void main(String[] args) {
        int arr[][] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};


        for (int i = 0; i < arr.length; i++) {
            for (int j = i; j < arr[i].length; j++) {
                int tmp = arr[i][j];
                arr[i][j] = arr[j][i];
                arr[j][i] = tmp;
            }
        }
        for (int i = 0; i < arr.length; i++)
            System.out.println(Arrays.toString(arr[i]));

    }
}
